// 封装web服务
const myweb = require('./myweb')
const fs = require('fs')
const app = myweb()

// jsonp解决跨域，只能get
app.get('/jsonp', (req, res) => {
  let cb = req.query.cb
  let users = JSON.stringify([
    { id: 1, name: '张三' },
    { id: 2, name: '李四' },
  ])
  res.send(`${cb}('${users}')`)
})

app.listen(3000, '0.0.0.0', () => {
  console.log('http://localhost:3000')
})